package com.byxy.action;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import com.byxy.entity.Book;
import com.byxy.service.BookService;
import com.opensymphony.xwork2.ActionSupport;

public class ListBookAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6523796976083504478L;
	Map<String, Object> data = new HashMap<String, Object>();
	public Map<String, Object> getData() {
		return data;
	}
	public Integer getPos() {
		return pos;
	}
	public Integer getRows() {
		return rows;
	}
	public void setData(Map<String, Object> data) {
		this.data = data;
	}
	public void setPos(Integer pos) {
		this.pos = pos;
	}
	public void setRows(Integer rows) {
		this.rows = rows;
	}
	private Integer pos;
	private Integer rows;
	@Resource
	private BookService bookService; 
	public String list() {
		List<Book> list = new ArrayList<>();
		list=bookService.find(pos,rows);
		data.put("list", list);
		data.put("count", bookService.count());
		return SUCCESS;
	}
}
